import React from 'react';
import './index.scss';
import Breadcrumbs from '../../components/breadcrumbs/index';
import getAboutMe from '../../request/get_about_me';

class AboutMeContainer extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      about: [],

    }
  }
  componentDidMount() {
    this.getAbout();
  }
  // 获取关于我的信息
  getAbout() {
    const params = {
      include: 33,
    }
    getAboutMe(params).then((res) => {
      if (res.status === 200) {
        this.setState({
          about: res.data,
        })
      }
    })
  }
  render() {
    const data = this.state.about[0];
    return (
      <div id="about-me-container">
        <div className="w">
          <div className="container">
            {this.state.about.length ?
              <div>
                <Breadcrumbs currentTitle={data.title.rendered} />
                <p className="about-title">
                  {data.title.rendered}
                </p>
                <p className="about-content" dangerouslySetInnerHTML={{ __html: data.content.rendered }} />
              </div>
              :
              <div className="loading">加载中...</div>
            }
          </div>
        </div>
      </div>
    )
  }
}
export default AboutMeContainer;
